package ast


type ReplCmd interface { impl(ReplCmd) }

func (ReplAssign) impl(ReplCmd) {}
type ReplAssign struct {
	Node               `part:"repl_assign"`
	Name  Identifier   `part:"name"`
	Expr  Expr         `part:"expr"`
}

func (ReplRun) impl(ReplCmd) {}
type ReplRun struct {
	Node         `part:"repl_run"`
	Expr  Expr   `part:"expr"`
}

func (ReplEval) impl(ReplCmd) {}
type ReplEval struct {
	Node         `part:"repl_eval"`
	Expr  Expr   `part:"expr"`
}

func ReplCmdGetExpr(cmd ReplCmd) Expr {
	switch cmd := cmd.(type) {
	case ReplAssign:
		return cmd.Expr
	case ReplRun:
		return cmd.Expr
	case ReplEval:
		return cmd.Expr
	default:
		panic("impossible branch")
	}
}


